package br.unip.tcc.domotic.orm;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Entity
@Table(name = "atuador")
@PrimaryKeyJoinColumn(name="cod_dispositivo")
public class Actuator extends Device {
	
	private static final long serialVersionUID = 1L;
	
	private ActuatorType actuatorType;
	private Set<Action> actions = new HashSet<Action>(0);
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cod_tipo_atuador", nullable = false)
	public ActuatorType getActuatorType() {
		return actuatorType;
	}
	
	public void setActuatorType(ActuatorType actuatorType) {
		this.actuatorType = actuatorType;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "actuator")
	public Set<Action> getActions() {
		return actions;
	}
	
	public void setActions(Set<Action> actions) {
		this.actions = actions;
	}
	
}
